'''
加载QMainWindow UI的模版
'''
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from ui.Ui_my_main_window import Ui_MyMainWindow

class MyMainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.ui = Ui_MyMainWindow()
        self.ui.setupUi(self)
        
        self.counter = 0
        self.init_ui()
    
    '''
    加载UI只需要修改下面的内容, 上面内容不需要修改
    '''   
    def on_pushbutton_3_click(self):
        self.statusBar().showMessage(f"按钮按下啦{self.counter}")
        self.counter += 1
    
    def on_refresh(self):
        print("refresh")
    
    def init_ui(self):
        self.ui.pushButton_3.clicked.connect(self.on_pushbutton_3_click)
        # 程序退出
        self.ui.actionExit.triggered.connect(QApplication.quit)
        # 刷新
        self.ui.actionRefresh.triggered.connect(self.on_refresh)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    
    w = MyMainWindow()
    w.show()
    
    sys.exit(app.exec_())
    